<template>
  <!-- 选项 -->
        <el-row v-if="optionShow">
          <el-col>
            <el-form-item label="选项：">
              <el-row v-if="btnShow">
                <el-col
                  class="el-cols"
                  v-for="(item, index) in options"
                  :key="index"
                >
                  <el-radio-group v-model="form.options">
                    <el-radio :label="item">
                      {{ item.code }}:<el-input
                        v-model="item.title"
                        style="width: 240px; line-height: 60px"
                      ></el-input>
                    </el-radio>
                  </el-radio-group>
                  <div
                    class="fileBtn"
                    @click="uploadPhoto(index)"
                  >
                    上传照片
                    <div class="fileBtn-delete">×</div>
                  </div>
                </el-col>
                <!-- <el-input type="file" style="display: none" ref="fileBtn"></el-input> -->
                <input
                  type="file"
                  ref="fileBtn"
                  style="display: none"
                  @change="changeFile"
                />
              </el-row>
              <el-row v-else>
                <input
                  type="file"
                  ref="fileBtn"
                  style="display: none"
                  @change="changeFile"
                />
                <el-col
                  class="el-cols"
                  v-for="(item, index) in options"
                  :key="index"
                >
                  <el-checkbox-group v-model="ruleForm.options">
                    <el-checkbox :label="item">
                      {{ item.code }}:<el-input
                        v-model="item.title"
                        style="width: 240px"
                      ></el-input>
                    </el-checkbox>
                  </el-checkbox-group>
                  <div
                    class="fileBtn"
                    @click="uploadPhoto(index)"
                  >
                    上传照片
                    <div class="fileBtn-delete">×</div>
                  </div>
                </el-col>
              </el-row>
              <el-col>
                <el-button
                  type="danger"
                  size="small "
                  :disabled="btnShow"
                  @click="addBtn(options)"
                >+增加选项和答案</el-button>
              </el-col>
            </el-form-item>
          </el-col>
        </el-row>
</template>

<script>
export default {
  data () {
    return {
      // 控制选项
      option: 4,
      textarea: '',
      index: '',
      btnShow: true,
      optionShow: true,
      options: [
        { isRigth: false, code: 'A', title: '', img: '' },
        { isRigth: false, code: 'B', title: '', img: '' },
        { isRigth: false, code: 'C', title: '', img: '' },
        { isRigth: false, code: 'D', title: '', img: '' }
      ]
    }
  }
}
</script>

<style>

</style>
